<?php $this->load->view('header'); ?>
<div id="content">
<div class="column full fl">
		
		<div class="box">
		<div class="box-header"><?php echo get_title();?></div>
		<div class="box-content box-table">
		<br />
		&nbsp;&nbsp;
		<?php echo isAccess('myuser','group','add') ? anchor('myuser/group/add', '<span class="icon_text addnew"></span>Tambah Group', 'class="button white"') : ''; ?>
		<div class="clear"></div>

        <?php if (isset($errorMessage)) : ?>
            <div class="notification <?php echo ((isset($isSuccess) && $isSuccess) ? 'success' : 'error');?>"><?php echo $errorMessage; ?></div>
        <?php endif; ?>
        
		<?php echo $paging?>
		<table class="tablebox">
		<thead class="table-header" style="border-top:1px solid #ccc;border-bottom:1px solid #ccc">
		<tr>
		     <?php /* ?>
	          <th><?php echo anchor_sort('myuser/group/view',$uri_to_assoc,'groupId','ID')?></td>
              <th><?php echo anchor_sort('myuser/group/view',$uri_to_assoc,'groupName',$this->lang->line('myuser_group_title'))?></td>
              <th><?php echo anchor_sort('myuser/group/view',$uri_to_assoc,'groupDesc',$this->lang->line('myuser_group_desc'))?></td>
              <th width="350" align="center"><?php echo $this->lang->line('global_action')?></td>
              <?php */ ?>
              <th>No</td>
              <th><?php echo $this->lang->line('myuser_group_title')?></td>
              <th><?php echo $this->lang->line('myuser_group_desc')?></td>
              <th width="350" align="center"><?php echo $this->lang->line('global_action')?></td>
		</tr>
		</thead>
		<tbody>
	
            <?php $i = true ;?>
            <?php $no = $uri_to_assoc['page'] + 1?>
			<?php if ($listGroup) foreach($listGroup as $key=>$row) : ?>
			
				<?php if( isAccess('myuser','group','viewrestricted') && ! isModule('administrator') ):?>
					<?php if( isUserGroup($row['groupKode']) ):?>
	                    <?php $i = $i ? false : true ; ?>
	                    <tr class="<?php echo $i ? 'even' : 'odd' ; ?>">
	                        <td><?php echo $no?></td>
	                        <td><?php echo sprintf("%+'-".($row['level'] * 4)."s",  ' ').$row['groupName']?></td>
	                        <td><?php echo $row['groupDesc']?></td>
	                        <td align="center">
	                            <?php echo isAccess('myuser','group','detail')  ? anchor('myuser/group/detail/id/'. $row['groupId'] .'/time/' . time(), $this->lang->line('global_detail'), 'class="button white"') : '';?>
	                            <?php echo isAccess('myuser','group','userview')  ? anchor('myuser/group/userView/id/'. $row['groupId'] , 'List User' , 'class="button white"') : '';?>
	                            <?php echo isAccess('myuser','group','edit')  ? anchor('myuser/group/edit/id/'. $row['groupId'] .'/time/' . time(), '<span class="icon_text edit"></span> '.$this->lang->line('global_edit'), 'class="button white"') : '';?>
	                            <?php echo isAccess('myuser','group','delete')  ? anchor('myuser/group/view/id/'. $row['groupId'] .'/action/delete/time/' . time(), '<span class="icon_text cancel"></span> '.$this->lang->line('global_delete') , array('onClick' => "return confirm('".$this->lang->line('global_confirm_delete')."')" , 'class' => "button white")) : '';?>
	                            &nbsp;
	                        </td>
	                    </tr>
						<?php $no++?>
					<?php endif?>
					
				<?php else:?>
					<?php $i = $i ? false : true ; ?>
                    <tr class="<?php echo $i ? 'even' : 'odd' ; ?>">
                        <td><?php echo $no?></td>
                        <td><?php echo sprintf("%+'-".($row['level'] * 4)."s",  ' ').$row['groupName']?></td>
                        <td><?php echo $row['groupDesc']?></td>
                        <td align="center">
                            <?php echo isAccess('myuser','group','detail')  ? anchor('myuser/group/detail/id/'. $row['groupId'] .'/time/' . time(), $this->lang->line('global_detail'), 'class="button white"') : '';?>
                            <?php echo isAccess('myuser','group','userview')  ? anchor('myuser/group/userView/id/'. $row['groupId'] , 'List User' , 'class="button white"') : '';?>
                            <?php echo isAccess('myuser','group','edit')  ? anchor('myuser/group/edit/id/'. $row['groupId'] .'/time/' . time(), '<span class="icon_text edit"></span> '.$this->lang->line('global_edit'), 'class="button white"') : '';?>
                            <?php echo isAccess('myuser','group','delete')  ? anchor('myuser/group/view/id/'. $row['groupId'] .'/action/delete/time/' . time(), '<span class="icon_text cancel"></span> '.$this->lang->line('global_delete') , array('onClick' => "return confirm('".$this->lang->line('global_confirm_delete')."')" , 'class' => "button white")) : '';?>
                            &nbsp;
                        </td>
                    </tr>
					<?php $no++?>
				<?php endif?>
					
            <?php endforeach;?>
		</tbody>
		</table>
		<div id="paging">
            <?php echo $paging?>
        </div>	
		</div>
		</div>
	
	</div>

<?php $this->load->view('footer'); ?>